#!/usr/bin/make -f

%:
	dh ${@}


override_dh_auto_build:
	# Remove Electron bundle
	sed -i '/"electron":/d' package.json
	sed -i '/"electron-osx-sign":/d' package.json
	sed -i '/"electron-packager":/d' package.json
	sed -i '/"electron-winstaller":/d' package.json
	
	# Build
	npm_config_cache=./npm_cache npm install
	npm run build
	npm prune --production
	
	# Remove absolute paths in node modules
	find . -name package.json -print0 | xargs -r -0 sed -i '/_where/d'
	
	# Delete unused files
	rm -f node_modules/*/{CHANGELOG.md,README.md,README,readme.md,readme}
	rm -rf node_modules/.cache

